class CreateOrderItems < ActiveRecord::Migration
  def change
    create_table :order_items, :force => true do |t|
      t.references :order, :null => false
      t.references :variant, :null => false
      t.string   :presentation, :limit => 70, :null => false
      t.string   :amount_type_name, :limit => 15, :null => true, :default => "ks"
      t.string   :parameters, :limit => 250, :null => true
      t.string   :number, :limit => 30, :null => false
      t.decimal  :tax, :precision => 4, :scale => 2, :null => false
      t.decimal  :price, :precision => 12, :scale => 3, :null => false
      t.integer  :quantity, :limit => 8,    :null => false
    end

    add_index :order_items, :order_id
    add_index :order_items, :variant_id
  end
end
